<?php
include 'config.php';
include 'createdb.php';
//Erstellung der Summe
$sum = mysql_query("SELECT SUM(`stimmen`) as s FROM `vereine`") OR die(mysql_error());
$sum = mysql_fetch_array($sum);
$fooo = mysql_query("SELECT *,(`stimmen`/".$sum['s'].")*100 AS p FROM `vereine` ORDER BY `stimmen` desc") OR die(mysql_error());

include '../header.php';
?>
	<title>&Uumlbung 1a Ergebnis</title>
	</head>
	<body class="background vereine">
	<div id="uebung" >
	<a class="dlbutton" href="/">Home</a>
	<a class="dlbutton" href="index.php">Voting</a>
	<table>
		<tr><td><p class="white">Alle Stimmen: </p></td><td><p class="pro" style="width:1000">	<?php echo $sum['s'] ?></p></td></tr> <?php 
			while($fetch = mysql_fetch_array($fooo)){
			echo '<tr><td class="white">'. $fetch["verein"] .'</td><td> <p class="pro" style="width:'. $fetch["p"]*10 .'px;">'. $fetch["p"].'<p/></td></tr>';
			};
		?>
	</table>
	</div>
	</body>
</html>